home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_2 / string.rev < prev    next >
Text File  |  1995-03-23  |  3KB  |  69 lines

  1. Article 3095 of comp.sys.handhelds:
  2. Path: en.ecn.purdue.edu!noose.ecn.purdue.edu!news.cs.indiana.edu!samsung!rex!wuarchive!sdd.hp.com!hp-pcd!hpcvra.cv.hp.com!rnews!hpcvbbs!akcs.dnickel
  3. From: akcs.dnickel@hpcvbbs.UUCP (Derek Scott Nickel)
  4. Newsgroups: comp.sys.handhelds
  5. Subject: REV - string reverse routine
  6. Keywords: rev
  7. Message-ID: <277c1d80:1523comp.sys.handhelds@hpcvbbs.UUCP>
  8. Date: 29 Dec 90 04:40:11 GMT
  9. Lines: 55
  10.  
  11. Here is an updated copy of my string reversing routine.  REV takes one
  12. arguement, the string to reverse. (Use ASC\-> to decode).
  13.  
  14.         Derek S. Nickel
  15.  
  16. %%HP: T(3)A(R)F(.);
  17. "D9D20D29512BF81D0040D9D208813063650FD5502C230F6E30C1C1632230CCD2
  18. 0940008F146608FB9760CC4C2147134169174147C2C213517914F14C1611C1CC
  19. 51F8D34150B9F06B2130B213063F9"
  20.  
  21. ========================================================================
  22.  
  23.        REV
  24.  
  25. 80000: 02D9D ! Program
  26. 80005: 1592D ; Set last RPL token to <0h> and verify DEPTH >= 1
  27. 8000A: 18FB2 ; Check arguments for type
  28. 8000F: 0400D ; <3h>
  29. 80014: 02D9D ! Program
  30. 80019: 03188 ; Internal DUP
  31. 8001E: 05636 ; Internal SIZE (1:String) -> System Binary
  32. 80023: 055DF ; ""
  33. 80028: 032C2 ; Internal OVER
  34. 8002D: 03E6F ; Internal multiply by 2 (1:System Binary)
  35. 80032: 61C1C ; allocate nibbles (2:sized object,1:System Binary)
  36. 80037: 03223 ; Internal SWAP
  37. 8003C: 02DCC ! Code
  38. 80041: 00049 ! 73 nibbles (next RPL at 8008A)
  39. 80046: 8F14660    GOSBVL 06641          ; MC: pop TOS (System Binary)
  40. into A.A
  41. 8004D: 8FB9760    GOSBVL 0679B          ; MC: save D0,D1,B,D (uses C,D0),
  42. clear carry
  43. 80054: CC         A=A-1  A              ; set-up loop, etc (size-1)
  44. 80056: 4C2        GOC    80083          ; exit if null string
  45. 80059: 147        C=DAT1 A              ; D1: ptr to new str data
  46. 8005C: 134        D0=C                  ; ...
  47. 8005F: 169        D0=D0+ 10             ; ...
  48. 80062: 174        D1=D1+ 5              ; D0: ptr to last char of orig
  49. str data
  50. 80065: 147        C=DAT1 A              ; ...
  51. 80068: C2         C=C+A  A              ; ...
  52. 8006A: C2         C=C+A  A              ; ...
  53. 8006C: 135        D1=C                  ; ...
  54. 8006F: 179        D1=D1+ 10             ; ...
  55. 80072: 14F        C=DAT1 B              ; get character from orig string
  56. 80075: 14C        DAT0=C B              ; put character to new string
  57. 80078: 161        D0=D0+ 2              ; next character
  58. 8007B: 1C1        D1=D1- 2              ; ...
  59. 8007E: CC         A=A-1  A              ; ...
  60. 80080: 51F        GONC   80072          ; go if more
  61. 80083: 8D34150    GOVLNG 05143          ; MC: restore D,B,D1,D0 (C=D0),
  62. clear carry and continue RPL
  63.  . . . . . . ! End of Code
  64. 8008A: 60F9B ; drop level two object
  65. 8008F: 0312B ! End Marker
  66. 80094: 0312B ! End Marker
  67.  
  68.  
  69.